import request from '@/config/axios'

// Look-IM系统配置接口定义

export interface SystemInfoVO {
  logo: string
  name: string
  state: string
  diyName?: string
  regauth: string
  regtype: string
  runMode: string
  ipregion: string
  closeTips: string
  description: string
  multipleLogin?: string
  registerInterval: string
}

export interface ChatInfoVO {
  stun: string
  online: string
  webrtc: string
  dbDelMsg: string
  msgClear: string
  redoTime: string
  stunPass: string
  stunUser: string
  groupChat: string
  simpleChat: string
  autoAddUser: {
    status: string
    welcome: string
    user_ids: string[]
    user_items: string[]
  }
  msgClearDay: string
  autoAddGroup: {
    name: string
    status: string
    userMax: string
    owner_uid: string
    owner_info: any[]
  }
  groupUserMax: string
  sendInterval: string
}

export interface FileUploadConfigVO {
  size: string
  preview: string
  fileExt: string[] | string
}

export interface CompassConfigVO {
  list: any[]
  mode: number
  status: number
}

export interface LookImConfigVO {
  sysInfo: SystemInfoVO
  chatInfo: ChatInfoVO
  fileUpload: FileUploadConfigVO
  compass: CompassConfigVO
  demon_mode: boolean
}

export interface LookImConfigSaveVO {
  sysInfo: SystemInfoVO
  chatInfo: ChatInfoVO
  fileUpload: FileUploadConfigVO
  compass: CompassConfigVO
}

// 获取Look-IM系统配置
export const getLookImConfig = () => {
  return request.get({ url: '/system/look-im-config/get' })
}

// 更新Look-IM系统配置
export const updateLookImConfig = (data: LookImConfigSaveVO) => {
  return request.put({ url: '/system/look-im-config/update', data })
}

// 重置Look-IM系统配置
export const resetLookImConfig = () => {
  return request.post({ url: '/system/look-im-config/reset' })
}